home *** CD-ROM | disk | FTP | other *** search
Text File | 1999-03-04 | 2.7 KB | 135 lines | [TEXT/ToyS] |
- property kasName : "BayWatch"
- property kasFinder : "Finder"
-
- property kasLinkingSock : "PPCToolBox"
- property kasServingSock : "AFPServer"
- property kasMachineSock : "WorkStation"
- property kasDoOnlyMacs : false -- Only Workstation sockets (else CyberStudio and other overtalkers)
-
- global gasInfo
- global gasInfoLoc
- global gasLastStatus
- global gasMaxLine, gasUpdateLine
-
-
- on run
- set gasInfoLoc to {-1, -1}
- set gasMaxLine to 0
- set gasLastStatus to {}
-
- try
- set gasInfoLoc to load preference named kasName
- on error
- end try
-
- set gasInfo to ¬
- display info titled kasName ¬
- located at gasInfoLoc
- end run
-
-
- on idle
- ShowAction("Checking…")
-
- if (UpdateStatus()) then
- ShowAction("Updating…")
- ShowStatus()
- end if
-
- ShowAction("Idle…")
-
- return 60
- end idle
-
-
- on ShowAction(act)
- display info gasInfo ¬
- message act ¬
- at line (gasMaxLine + 1) ¬
- with static state
- end ShowAction
-
-
- on UpdateStatus()
- set x to the network server names listing all sockets
- if (x is not gasLastStatus) then
- set gasLastStatus to x
- return true
- end if
- return false
- end UpdateStatus
-
-
- on ShowStatus()
- set gasUpdateLine to 0
-
- repeat with z in gasLastStatus
- set zoneName to item 1 of z
- ShowStatusZone(zoneName, number of items in (item 2 of z))
- repeat with mac in (item 2 of z)
- set macName to item 1 of mac
- set socks to item 2 of mac
- set isMac to (socks contains kasMachineSock)
- if (not kasDoOnlyMacs or isMac) then
- set isLink to (socks contains kasLinkingSock)
- set isServ to (socks contains kasServingSock)
- ShowStatusMac(macName, isMac, isLink, isServ)
- end if
- end repeat
- end repeat
-
- if (gasUpdateLine ≥ gasMaxLine) then
- set gasMaxLine to gasUpdateLine
- else
- repeat with x from (gasUpdateLine + 1) to gasMaxLine
- display info gasInfo message "…" at line x
- end repeat
- end if
- end ShowStatus
-
-
- on ShowStatusMac(mac, isLink, isServ, isMac)
- set gasUpdateLine to gasUpdateLine + 1
-
- set mac to " " & mac
-
- set col to 0
- if isLink then set col to col + 12
- if isServ then set col to col + (12 * 1024)
- if not isMac then set col to 12 * 32
-
- display info gasInfo ¬
- message mac ¬
- at line gasUpdateLine ¬
- using color col ¬
- using size 9 ¬
- using font "Monaco" with static state
- end ShowStatusMac
-
-
- on ShowStatusZone(zName, nMacs)
- set gasUpdateLine to gasUpdateLine + 1
-
- display info gasInfo ¬
- message (zName & " (" & nMacs & ")") ¬
- at line gasUpdateLine ¬
- using color (12 * 32) ¬
- using size 9 ¬
- using font "Monaco" with static state
- end ShowStatusZone
-
-
- on quit
- ShowAction("Quitting…")
-
- set gasLastStatus to {}
-
- set newLoc to screen location of ¬
- (display info gasInfo with disposal)
-
- if (newLoc is not gasInfoLoc) then ¬
- save preference newLoc named kasName
-
- continue quit
- end quit
-